:Init
@setlocal ENABLEEXTENSIONS ENABLEDELAYEDEXPANSION
@pushd %~dp0
@prompt $_
@echo off

if "%1" == "/?" goto Usage
if "%1" == "-?" goto Usage
goto :Install

:Usage
@echo.
@echo Downloads and installs WebDeploy engine using the Web Platform
@echo Installer (WPI).
@echo.
@echo WEBDEPLOY.SETUP <port>
@echo.
@goto :eof

:WebDeployMSI
if not "%1" == "" set WebDeployPort=%1 
if "%WebDeployPort%" == "" set WebDeployPort=8172 
msiexec /i webdeploy.msi /passive ADDLOCAL=ALL LISTENURL=http://+:%WebDeployPort%/MSDEPLOY2/
goto :eof

:Install
"%~dp0\webpicmd\webpicmdline.exe" /Products: WDeploy /xml:https://www.microsoft.com/web/webpi/2.0/RTM/WebProductList.xml /log:webdeploy.txt
net stop wmsvc
net start wmsvc
@goto :End

:End
@echo Completed.
exit /b /0
goto :eof
